//
// Created by Administrator on 2023/7/29.
//
#include <string>
#include <iostream>

using namespace std;

class Solution {
public:
    string removeTrailingZeros(string num) {
        while (num.back() == '0') {
            num.pop_back();
        }
        return num;
    }
};

class Solution2 {
public:
    string removeTrailingZeros(string num) {
        int len = num.size();
        int t = len;
        for (int i = len - 1; i >= 0; i--) {
            if (num[i] == '0') {
                t = i;
            } else {
                break;
            }
        }
        string r = num.substr(0, t);
        return r;
    }
};

int main() {
    Solution s;
    cout << s.removeTrailingZeros("51230100") << endl;
    cout << s.removeTrailingZeros("123") << endl;


}
